<template>
  <div class="wrapper">
    <swiper :options="swiperOptions" v-if="showSwiper">
      <swiper-slide v-for="aa of swiperList" :key="aa.id">
        <img class="swiper-img" :src="aa.imgUrl"/>
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
export default {
  name: 'homeSwiper',
  props: {
    swiperList: [],
  },
  data() {
    return {
      swiperOptions: {
        pagination: '.swiper-pagination',
        loop: true,
      },
    };
  },
  computed: {
    showSwiper() {
      return this.swiperList.length;
    },
  },
};
</script>

<style scoped>
  /*样式穿透,线面3个箭头指定父下的子css样式*/
  .wrapper >>> .swiper-pagination-bullet-active{
    background: #ffffff;
  }
  .wrapper{
    width: 100%;
    height: 0px;
    padding-bottom: 30%;
    background: antiquewhite;
  }
  .swiper-img {
    width: 100%;
  }
</style>
